package acm.蓝桥杯15;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;

public class 峰值 {
    public static void main(String[] args) {
        Reader sc=new Reader();
        int n = sc.nextInt();
        while (n-- > 0) {
            int m = sc.nextInt();
            int[] nums = new int[m];
            for (int i = 0; i < nums.length; i++) {
                nums[i] = sc.nextInt();
            }
            System.out.println(check(nums)?"Yes":"No");
        }
    }

    private static boolean check(int[] nums) {
        int peak = getPeak(nums);
        if (peak==1||peak==nums.length){
            return false;
        }
        return isPeak(nums,peak);
    }
    public static int getPeak(int[] nums){
        int l=0,r=1;
        while (r<nums.length){
            if (nums[l]>=nums[r]) {
                return r;
            }
            l++;
            r++;
        }
        return r;
    }
    public static boolean isPeak(int[] nums,int i){
        int r = i+1;
        while (r<nums.length){
            if (nums[i]<=nums[r]){
                return false;
            }
            i++;
            r++;
        }
        return true;
    }

    private static class Reader {
        static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

        public static int nextInt() {
            try {
                in.nextToken();
            } catch (Exception ignored) {}
            return (int) in.nval;
        }
    }

}
